﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ColdStorage;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;

namespace ColdStorage.DOL
{
    [Serializable]
    public class Product
    {
        
        #region Product Properties
        private double dbproductImportTemp; // nhiet do sp nham vao
        private double dbproductImportUnevenCoefficient;// he so nhap hang ko dong deu
        private double dbproductRotationCoefficient;// he so quay vong hang
        private double dbproductStorageTemp;// nhiet do trong kho
        private double dbproductVolumeDailyImport;// khoi luong hang nhap vao tren ngay dem
        private double dbinputVolume;// khoi luong bao bi
        private int iwrappingType = -1;// loai bao bi

        public int iWrappingType
        {
            get { return iwrappingType; }
            set { iwrappingType = value; }
        }

        private double dbwrappingRate;

        public double dbWrappingRate
        {
            get { return dbwrappingRate; }
            set { dbwrappingRate = value; }
        }

        private double dbenthalpyBefore;
        private double dbenthalpyAfter;
        private double dbwrappingThermalCapacity;// nhiet dung rieng cua bao bi
        private double dboriginalTemp;

        private double dbwrappingInputVolume;

        public double dbWrappingInputVolume
        {
            get { return dbwrappingInputVolume; }
            set { dbwrappingInputVolume = value; }
        }

        public double dbOriginalTemp
        {
            get { return dboriginalTemp; }
            set { dboriginalTemp = value; }
        }

        public double dbProductImportTemp
        {
            get { return dbproductImportTemp; }
            set { dbproductImportTemp = value; }
        }

        public double dbProductImportUnevenCoefficient
        {
            get { return dbproductImportUnevenCoefficient; }
            set { dbproductImportUnevenCoefficient = value; }
        }

        public double dbProductRotationCoefficient
        {
            get { return dbproductRotationCoefficient; }
            set { dbproductRotationCoefficient = value; }
        }

        public double dbProductStorageTemp
        {
            get { return dbproductStorageTemp; }
            set { dbproductStorageTemp = value; }
        }

        public double dbProductVolumeDailyImport
        {
            get { return dbproductVolumeDailyImport; }
            set { dbproductVolumeDailyImport = value; }
        }

        public double dbInputVolume
        {
            get { return dbinputVolume; }
            set { dbinputVolume = value; }
        }

        public double dbEnthalpyBefore
        {
            get { return dbenthalpyBefore; }
            set { dbenthalpyBefore = value; }
        }

        public double dbEnthalpyAfter
        {
            get { return dbenthalpyAfter; }
            set { dbenthalpyAfter = value; }
        }

        public double dbWrappingThermalCapacity
        {
            get { return dbwrappingThermalCapacity; }
            set { dbwrappingThermalCapacity = value; }
        }
        #endregion
 
        // Tính dòng nhiệt do sản phẩm tỏa ra
        public double CalculateProductHeat(double dbRoomCapacity)
        {                     
           return (((dbRoomCapacity * dbproductRotationCoefficient * dbproductImportUnevenCoefficient / 365) *
               (dbenthalpyBefore - dbenthalpyAfter) * (0.0116)));
        }
        // Tính dòng nhiệt do bao bì tỏa ra
        public double Calculatewrappingheat()
        {
            
            return dbwrappingInputVolume * dbwrappingThermalCapacity * (dboriginalTemp - dbproductStorageTemp) * (0.0116);

        }

        //Tính khối lượng bao bì đưa vào
        public double CalculateWrappingVolume(double weight_rate)
        {
            return dbproductVolumeDailyImport * (weight_rate / 100);
        }
    }
    
}
